"""
The md5 check method.
@author: Kenneth Tse  xie.kenneth@gmail.com
"""
import hashlib

description = "The md5 check method."
name = "Md5Checker"

class Md5Checker:
    def __init__(self):
        """
        Initialize a md5 checker.
        """
        self.hasher = hashlib.md5()
        
    def digest(self):
        return self.hasher.hexdigest();
    
    def update(self, data):
        self.hasher.update(data)
    
    def digestSize(self):
        return self.hasher.digest_size
    
    def reset(self):
        self.hasher = hashlib.md5()

    @staticmethod
    def getDigest(data):
        return hashlib.md5(data).hexdigest();
    

        
        
